- show_roles = local_assigns.fetch(:show_roles, true)
- force_mobile_view = local_assigns.fetch(:force_mobile_view, false)
- member = local_assigns.fetch(:member)
- current_user_is_group_owner = local_assigns.fetch(:current_user_is_group_owner, false)
- membership_source = local_assigns.fetch(:membership_source)
- group = local_assigns.fetch(:group)
- user = local_assigns.fetch(:user, member.user)
- source = member.source

-# Note this is just for individual members. For groups please see shared/members/_group

%li.member.js-member.py-2.px-3.d-flex.flex-column{ class: [dom_class(member), ("flex-md-row" unless force_mobile_view)], id: dom_id(member), data: { qa_selector: 'member_row' } }
  %span.list-item-name.mb-2.m-md-0
    - if user
      = render Pajamas::AvatarComponent.new(user, size: 32, class: 'gl-mr-3 flex-shrink-0 flex-grow-0')
      .user-info
        %span.mr-1
          = link_to user.name, user_path(user), class: 'member js-user-link', data: { user_id: user.id }
          = user_status(user)
          %span.cgray= user.to_reference

        .mx-n1.d-inline-flex.flex-wrap
          = render_if_exists 'shared/members/ee/sso_badge', member: member

          = render_if_exists 'shared/members/ee/gma_badge', member: member

          = render 'shared/members/its_you_badge', user: user, current_user: current_user

          = render_if_exists 'shared/members/ee/license_badge', user: user, group: group, current_user_is_group_owner: current_user_is_group_owner

          = render 'shared/members/blocked_badge', user: user

          = render 'shared/members/two_factor_auth_badge', user: user

        - if source.instance_of?(Group) && source != membership_source
          &middot;
          = link_to source.full_name, source, class: "gl-display-inline-block inline-link"

        .cgray
          - if member.request?
            = _("Requested %{time_ago}").html_safe % { time_ago: time_ago_with_tooltip(member.requested_at) }
          - else
            = _("Given access %{time_ago}").html_safe % { time_ago: time_ago_with_tooltip(member.created_at) }
          %span.js-expires-in{ class: ('gl-display-none' unless member.expires?) }
            &middot;
            %span.js-expires-in-text{ class: "has-tooltip#{' text-warning' if member.expires_soon?}", title: (member.expires_at.to_time.in_time_zone.to_fs(:medium) if member.expires?) }
              - if member.expires?
                - preposition = current_user.time_display_relative ? '' : 'on'
                = _("Expires %{preposition} %{expires_at}").html_safe % { expires_at: time_ago_with_tooltip(member.expires_at), preposition: preposition }

    - else
      = image_tag avatar_icon_for_email(member.invite_email, 40), class: "avatar s40 flex-shrink-0 flex-grow-0", alt: ''
      .user-info
        .member= member.invite_email
        .cgray
          Invited
          - if member.created_by
            by
            = link_to member.created_by.name, user_path(member.created_by)
          = time_ago_with_tooltip(member.created_at)
  - if show_roles
    .controls.member-controls.align-items-center
      = render_if_exists 'shared/members/ee/ldap_tag', can_override: member.can_override?
      %span.member-access-text.user-access-role= member.human_access
